package com.comprehensive.personalmovie.feign;

import com.comprehensive.common.dto.PageResponse;
import com.comprehensive.common.po.MovieEpisodes;
import com.comprehensive.common.po.MovieSeasons;
import com.comprehensive.common.po.Movies;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "data-access-service",contextId = "movieFeignClient")
public interface MovieFeignClient {

    @GetMapping("/movie/listPage")
    PageResponse<Movies> listPage(
            @RequestParam(defaultValue = "1") int pageNum,
            @RequestParam(defaultValue = "10") int pageSize,
            @RequestParam(defaultValue = "0") int type,
            @RequestParam String name
    ) ;
    @GetMapping("/movie/{id}")
    Movies getById(@PathVariable("id") Long id);

    @PostMapping("/movie")
    boolean save(@RequestBody Movies movies);

    @PutMapping("/movie")
    boolean update(@RequestBody Movies movies);

    @DeleteMapping("/movie/{id}")
    boolean delete(@PathVariable("id") Long id);

    @GetMapping("/movie/seasons/{movieId}")
    List<MovieSeasons> getSeasonsByMovieId(@PathVariable Long movieId);
    @GetMapping("/movie/episodesOnly/{id}")
    MovieEpisodes getEpisodesById(@PathVariable Long id);
    @GetMapping("/movie/episodes/{seasonsId}")
    List<MovieEpisodes> getEpisodesBySeasonsId(@PathVariable Long seasonsId);

    @PostMapping("/movie/seasons")
    boolean saveSeasons(@RequestBody MovieSeasons movieSeasons);

    @PostMapping("/movie/episodes")
    boolean saveEpisodes(@RequestBody MovieEpisodes movieEpisodes);

    @PutMapping("/movie/seasons")
    boolean updateSeasons(@RequestBody MovieSeasons movieSeasons);

    @PutMapping("/movie/episodes")
    boolean updateEpisodes(@RequestBody MovieEpisodes movieEpisodes);

    @DeleteMapping("/movie/seasons/{id}")
    boolean deleteSeasons(@PathVariable Long id);

    @DeleteMapping("/movie/episodes/{id}")
    boolean deleteEpisodes(@PathVariable Long id);
}